using UnityEngine;


namespace Game
{
    public partial class CharacterMotor : MonoBehaviour
    {
        private CharacterController m_Controller;
        private Animator m_Animator;

        private void Awake()
        {
            this.m_Controller = gameObject.GetComponent<CharacterController>();
            this.m_Animator = gameObject.GetComponent<Animator>();   
        }

        public void MoveByDirection(Vector3 direction)
        {
            this.m_Controller.Move(direction * Time.deltaTime * MoveSpeed);
            this.m_Animator.SetFloat(MoveBlend, direction.sqrMagnitude);
            this.transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(direction), Time.deltaTime * RotateSpeed);
        }

        public void LookAtImmediately(Vector3 pos)
        {
            this.transform.rotation = Quaternion.LookRotation(pos);
        }

        public void Destroy()
        {
            GameObject.Destroy(this.gameObject);
        }
        
    }
}